package matt.design;

import java.util.ArrayList;
import java.util.Date;


public class Group {
	
	private String name;
	private ArrayList<Item> items = new ArrayList<Item>();
	
	public Group() {}
	
	public Group(String name){
		this.name = name;
	}
	
	public void addItem(Item task){
		items.add(task);
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	
	public ArrayList<Item> getAllItems(){
		return items;
	}
		
	/**
	 * This method transfers all of the default group and then clears array
	 * @param defGroup
	 */
	public void deleteGroup(Group defGroup){
		ArrayList<Item> defList = defGroup.getAllItems();
		for(int i = 0; i < items.size(); i++){
			defList.add(items.get(i));
		}
		items = null;
	}
	
	public Item deleteTask(Item task){
		int index = items.indexOf(task);
		Item remove = items.get(index);
		items.remove(index);
		return remove;
	}
	
//	public Task editItem(Task Task, String itemName, String desc, String dueDate, String startDate, short prority, Group taskGroup, String recurring){
//		Task edit = new Task(itemName, desc, dueDate, startDate, prority, taskGroup, recurring);
//		return edit;
//	}
	
}
